package response

type ResponseStruct struct {
	Code    int         `json:"code"`
	Data    interface{} `json:"data"`
	Message string      `json:"message"`
}

func Error(message string) ResponseStruct {
	return ErrorWithCode(1, message)
}

func ErrorWithCode(code int, message string) ResponseStruct {
	return ResponseStruct{
		Code:    code,
		Data:    nil,
		Message: message,
	}
}

func Success(data interface{}) ResponseStruct {
	return SuccessWithMessage(data, "success")
}

func SuccessWithMessage(data interface{}, msg string) ResponseStruct {
	return ResponseStruct{
		Code:    0,
		Data:    data,
		Message: msg,
	}
}
